package com.sc.VenusQueryBeta.adapter.account.cunka;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseViewHolder;
import com.hengjun.kingstar.sdk.utils.StringUtils;
import com.sc.VenusQueryBeta.R;
import com.sc.VenusQueryBeta.adapter.BaseCompatAdapter;
import com.sc.VenusQueryBeta.model.bean.account.cunka.CunKaList2;

import java.util.List;

import static com.hengjun.kingstar.sdk.utils.StringUtils.getStrTime;
import static com.hengjun.kingstar.sdk.utils.StringUtils.getTime;


/**
 * Created by Administrator on 2018/10/17.
 *
 */

public class CunKa02Adapter extends BaseCompatAdapter<CunKaList2.CunkaList,BaseViewHolder> {


    private  String roomname;

    public CunKa02Adapter(int item_cunka02) {
        super(item_cunka02);
    }

    public CunKa02Adapter(int item_cunka02, List<CunKaList2.CunkaList> list,String roonname) {
        super(item_cunka02, list);
        this.roomname = roonname;
    }


    @SuppressLint("ResourceAsColor")
    @Override
    protected void convert(BaseViewHolder helper, CunKaList2.CunkaList item) {
        helper.setText(R.id.tv_username_daishu,item.getClientid());//戶口

        if (item.getRoomname() == null || item.getRoomname().equals("")) {
            helper.setText(R.id.roomid,roomname);//集團名字
        } else {
            helper.setText(R.id.roomid,item.getRoomname());//集團名字
        }
        helper.setText(R.id.tv_jyje,item.getTradenum()+mContext.getString(R.string.wan));//交易金額
        helper.setText(R.id.tv_ye, item.getDepositsum()+mContext.getString(R.string.wan));//餘額
        helper.setText(R.id.beizhu,item.getRemark());//備註
        //存儲類型
        TextView type = helper.getView(R.id.tv_typecc);
        if (item.getTradetype().equals("0")){
          type.setText(R.string.cunkuan);
          type.setTextColor(Color.BLUE);
        }else if (item.getTradetype().equals("1")){
           type.setText(R.string.qukuan);
           type.setTextColor(Color.RED);
        }
//       // helper.setText(R.id.tv_time,item.getRoomdate());
//        String re_str = getTime(item.getRoomdate()+"");//時間
//        String data = getStrTime(re_str);
        helper.setText(R.id.tv_time,item.getRoomdate());
    }
}
